package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId      int64  `gorm:"type:int;index;comment:用户id"`
	OrderSn     string `gorm:"type:char(36);not null;comment:订单号"`
	PayType     int64  `gorm:"type:tinyint(1);default:1;comment:支付类型:1:支付宝,2:微信"`
	PayTime     string `gorm:"type:datetime(3);comment:支付时间"`
	Amount      int64  `gorm:"type:int(11);comment:金额"`
	OrderStatus int64  `gorm:"type:tinyint(1);default:1;comment:订单状态:1待支付,2:已支付,3:已退款,4:已取消,5:已完成"`
}

func (o *Order) Create() error {
	return Db.Create(&o).Error
}
